<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			var arr=[-1,-2,-3,7,6,5,99];
			var max=arr[0];
			var min=arr[0];
			var maxposition=0;
			var minposition=0;
			for(var i=1;i<arr.length;i++){
				if(arr[i]>max){
					max=arr[i];
					maxposition=i;
					
				}
				if(arr[i]<min){
					min=arr[i];
					minposition=i;
				}
			}
			console.log("最大值："+max);
			console.log("最小值："+min);
			console.log("最大值位置"+maxposition);
			console.log("最小值位置"+minposition);
		</script>
	</body>
</html>
